<template>
    <div>
        <input type="file" name="fileUpload" id="fileUp" @change="update" ref="inputFile">

    </div>

</template>
<script>
import axios from "axios";
export default {
    name: "file",
    data() {
        return {
            file: null
        };
    },
    created() {},
    mounted() {
        this.$nextTick(function() {});
    },
    methods: {
        update(event) {
            let data = document.getElementById(`fileUp`).value;
            // let data =this.$refs.inputFile;
            console.log(`>>>>>>>>>>>`, data);

            console.log(`evant>>>>>>>>>>>>>>>`, event.target.files);

            let formdata = new FormData();
            formdata.append("file", event.target.files[0]);
            formdata.append("action", "test");
            axios({
                url: "http://192.168.0.121:5555/updateOne",
                method: "post",
                data: formdata
                // headers: { "Content-Type": "multipart/form-data" }
            }).then(res => {
                console.log(res);
            });
        }
    }
};
</script>
<style>
</style>
